<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
var docIssue=new Object();
$(function(){
	docIssue.docId="<c:out value='${docIssue.docId}' />";
	docIssue.formId="<c:out value='${docIssue.formId}' />";
	docIssue.describeName="<c:out value='${describeName}' />";
	docIssue.processId="<c:out value='${docIssue.processId}' />";
	docIssue.workEffortId="<c:out value='${workEffortId}' />";
	$('#signFormDiv').dialog({
	    title: '基本要素',
	    width: 980,
	    height: 400,
	    closed: true,
	    cache: false,
	    //href: "<c:url value='/docDispatch/add' />",
	    top:300,
	    modal: true,
	    buttons:[{
			text:'保存',
			//id:'dialogSaveBtn',
			handler:function(){
				saveDocIssueData();
			}
		},{
			text:'取消',
			//id:'dialogCloseBtn',
			handler:function(){
				$('#signFormDiv').dialog("close");
			}
		}]
	});
});

function _openBasicInfo(){
	//docId：流程id，formId：表单id，describeName：发文标题，editFlag：基本要素编辑状态----1可编辑、0不可编辑
	var url="?docId="+docIssue.docId+"&formId="+docIssue.formId+"&describeName="
	+encodeURIComponent(encodeURIComponent(docIssue.describeName))+"&processId="+docIssue.processId+"&editFlag=1";
	$('#signFormDiv').dialog('refresh', '<c:url value="/docDispatch/baseAdd" />'+url).dialog("open").window('center');
}
function _saveOAdata(){
	if(!checkPageItems()){//页面验证不通过
		return 1;
	}
	var status = submitOAdata();
	if(status != 100)
	{
		return 2;
	}
	return 0;//0:保存成功，1：验证未通过，2：数据保存错误
}
//保存数据
function submitOAdata(){
	return 100;
}
//验证
function checkPageItems(){
	if(docIssue.docId==""){
		$.messager.alert("提示","请先保存基本要素");
		return false;
	}
	return true;
}
//关闭基本要素弹出框
function closeDialog(){
	$('#signFormDiv').dialog("close");
}
//红表格显示基本要素中已保存的docIssue信息
function showBaseData(model){
	if(!$.isEmptyObject(model)){
		docIssue.docId=model.docId;
		$("#displayNumberSpan").text(model.displayNumber);
		$("#emergencyCodeSpan").text(model.emergencyCode);
		$("#secretCodeSpan").text(model.secretCode);
		$("#printNumSpan").text(model.printNum);
		$("#docNameSpan").text(model.docName);
	}
}
//红表格显示基本要素中已保存的附件信息
function showFileData(docId){
	$("#docFileDiv").empty();
	$.ajax({
		   type: "POST",
		   url: "<c:url value='/docDispatch/getFileList'/>",
		   data: "docId="+docId,
		   success: function(msg){
			   if(!$.isEmptyObject(msg)){
					$.each( msg, function(i, n){
						$("#docFileDiv").append('('+(i+1)+')'+n.attachName+n.suffixName+'<br>');
					});
				}
		   }
		});
	
}